import time
 
""" takes about 14 seconds """

start = time.clock()
 
cap = 2000000
answer = 10
def primed(num):
    if num == 2:
        return True
    if num % 2 == 0:
        return False
    for x in range(3, int(num ** 0.5) + 1, 2):
        if num % x == 0:
            return False
    return True
 
for z in xrange(7, cap):
    if z % 2 != 0 and z % 3 != 0 and z % 5 != 0:
        if primed(z):
            answer += z
 
end = time.clock()
t = end - start
print "Answer: " + str(answer) + " in " + str(t) + " seconds"
